package day08.difference;

/**
 * @Auther: sky
 * @Date: 2019/3/5 23:44
 * @Description:
 */
public class ClassSyncLock {

    public static String username;
    public static String password;

    public synchronized static void login(String name, String pass) {
        try {
            if (name.equals("a")) {
                username = name;
                Thread.sleep(2000);
            }
            password = pass;
            System.out.println("username=" + username + ",pass=" + password);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


}
